package com.qhit.pojo;

import javafx.scene.input.DataFormat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Goods {
    private int id;
    private String name;
    private Date startDate;
    private Date endDate;
    private String outType;
    private Double money;
    private int maxNum;
    private int storeNum;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getOutType() {
        return outType;
    }

    public void setOutType(String outType) {
        this.outType = outType;
    }

    public Double getMoney() {
        return money;
    }

    public void setMoney(Double money) {
        this.money = money;
    }

    public int getMaxNum() {
        return maxNum;
    }

    public void setMaxNum(int maxNum) {
        this.maxNum = maxNum;
    }

    public int getStoreNum() {
        return storeNum;
    }

    public void setStoreNum(int storeNum) {
        this.storeNum = storeNum;
    }
    public void setDoubleDate(String doubleDate){
        if (doubleDate!=null&&!"".equals(doubleDate)){
            String[] split=doubleDate.split(" - ");
            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            try {
                Date start = simpleDateFormat.parse(split[0]);
                Date end = simpleDateFormat.parse(split[1]);
                this.startDate=start;
                this.endDate=end;
            }catch (ParseException e){
                e.printStackTrace();
            }
        }
    }
    public String getDoubleDate(){
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return simpleDateFormat.format(this.startDate)+" - "+simpleDateFormat.format(this.endDate);
    }
}
